
void simple_putc(char c)
{
	*((char *)(UART_ADDR)) = c;
	
}

void simple_puts(char *str)
{
	while(*str){
		simple_putc(*str);
		str++;
	}
}

char * ultostr(unsigned int val, char *buf_end, int base)
{
	static const char *num_str="0123456789ABCDEF";
	unsigned int t_val = val;
	int inx = 0;
	while(t_val) {
		inx = t_val % base;
		t_val = t_val / base;
		buf_end--;
		*buf_end = num_str[inx];
	}
	return buf_end;
}

void print_u64(unsigned int val, int base)
{
	char buf[17];
	buf[17] = 0;
	char *s = ultostr(val, buf+sizeof(buf), base);
	simple_puts(s);
	simple_putc('\n');
}

void simple_print_u32_hex(unsigned int val)
{
	simple_puts("0x");
	print_u64(val, 16);
}

// void test_u64(int val)
// {
// 	val = 2;
// }

// int main(int argc, char const *argv[])
// {
// 	long test=-1;
// 	print_u64(test, 16);
// 	printf("%x\n", test);
// 	return 0;
// }
